﻿
/////////////////////////////////////////////////////////////////
//File: ArticleDao.cs
//Description: 
//Copyright© 2011 Moliu
//History:
//  2011-3-26 18:11:20    CodeSmith5.0.1    Original Version
/////////////////////////////////////////////////////////////////
using System;
using MAF.CRUD;
using My.Blog.Domain.Entities;

namespace My.Blog.Database.Persistence
{
    public partial class ArticleDao : DatabaseCRUD<Article>
    {
        protected override string _MapAdd { get { return "Article.Add"; } }
        protected override string _MapUpdate { get { return "Article.Update"; } }
        protected override string _MapDelete { get { return "Article.Delete"; } }
        protected override string _MapSearch { get { return "Article.Search"; } }
        protected override string _MapCount { get { return "Article.Count"; } }

        private string _IncreaseCommentAmountSqlKey = "Articles.IncreaseCommentAmount";
        private string _IncreaseVistedAmountSqlKey = "Articles.IncreaseVisitedAmount";
        private string _MoveArticleToSqlKey = "Articles.MoveArticleTo";  

        // 构造函数
        public ArticleDao( string configFile,string tableName ) : base(configFile,tableName){}
        
        //public int IncreaseCommentAmount(Guid id, int num)
        //{
        //    ArticleInfo info = new ArticleInfo();
        //    info.Id = id;
        //    info.CommentsCount = num;
        //    return map.Update(_IncreaseCommentAmountSqlKey, info);
        //}

        //public int IncreaseVisitedAmount(Guid id, int num)
        //{
        //    ArticleInfo info = new ArticleInfo();
        //    info.Id = id;
        //    info.VisitedCount = num;
        //    return map.Update(_IncreaseVistedAmountSqlKey, info);
        //}

        //public int MoveArticleTo(string articleIds, int categoryId, int width)
        //{
        //    ArticleInfo info = new ArticleInfo();
        //    info.Ids = articleIds;
        //    info.CategoryId = categoryId;
        //    return map.Update(_MoveArticleToSqlKey, info);
        //}  
    }
}
    